package com.base.autoproxy.cglib;

import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @Author HBZ
 * @Date 2020/11/4 9:09
 * @Description
 */
public class CglibProxyInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object sub, Method method, Object[] objects, MethodProxy methodProxy)
            throws Throwable {
        System.out.println("执行前");
        Object object = methodProxy.invokeSuper(sub, objects);
        System.out.println("执行后");
        return object;
    }
}
